package com.joyintech.modules.workflow.rest;

import com.joyintech.annotation.Log;
import com.joyintech.modules.workflow.service.WorkFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

/**
 * 3.流程实例控制器
 * @author daiweiwei
 * @date 2018-12-03
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "系统：流程管理->流程实例")
@RequestMapping("/api/workflow/instance")
public class ProcessInstanceController {
    private final WorkFlowService workFlowService;

    @Log("删除流程实例")
    @ApiOperation("删除流程实例")
    @DeleteMapping
    @PreAuthorize("@el.check('instance:del')")
    public ResponseEntity<Object> delete(String procInsId, String reason){
        workFlowService.deleteProcessInstance(procInsId,reason);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
